/**
 * Copyright : www.orientpay.com , 2007-2011
 * Project : sqt_spider_main
 * $Id$
 * $Revision$
 * Last Changed by ZhouXushun at 2011-5-10 下午03:02:32
 * $URL$
 * 
 * Change Log
 * Author      Change Date    Comments
 *-------------------------------------------------------------
 * ZhouXushun     2011-5-10        Initailized
 */

package com.youthor.spider.core.dto;

import java.io.Serializable;

/**
 * TODO Add class descriptions
 * 
 */
public class HttpProxyDTO implements Serializable{
	private static final long serialVersionUID = 6264710613720529491L;
	
	//格式如： IP;端口;用户名;密码;权重
	private String ipAddress;
	private int port = 80;
	private boolean isNeedAuth = false;
	private String authName;
	private String authPwd;
	//权重
	private int proportion = 1;
	
	public String getIpAddress() {
		return ipAddress;
	}

	public void setIpAddress(String ipAddress) {
		this.ipAddress = ipAddress;
	}

	public int getPort() {
		return port;
	}

	public void setPort(int port) {
		this.port = port;
	}

	public boolean isNeedAuth() {
		return isNeedAuth;
	}

	public void setNeedAuth(boolean isNeedAuth) {
		this.isNeedAuth = isNeedAuth;
	}

	public String getAuthName() {
		return authName;
	}

	public void setAuthName(String authName) {
		this.authName = authName;
	}

	public String getAuthPwd() {
		return authPwd;
	}

	public void setAuthPwd(String authPwd) {
		this.authPwd = authPwd;
	}

	public int getProportion() {
		return proportion;
	}

	public void setProportion(int proportion) {
		this.proportion = proportion;
	}

	@Override
	public String toString() {
		return "HttpProxyDTO [authName=" + authName + ", authPwd=" + authPwd
				+ ", ipAddress=" + ipAddress + ", isNeedAuth=" + isNeedAuth
				+ ", port=" + port + ", proportion=" + proportion + "]";
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((authName == null) ? 0 : authName.hashCode());
		result = prime * result + ((authPwd == null) ? 0 : authPwd.hashCode());
		result = prime * result
				+ ((ipAddress == null) ? 0 : ipAddress.hashCode());
		result = prime * result + (isNeedAuth ? 1231 : 1237);
		result = prime * result + port;
		result = prime * result + proportion;
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		HttpProxyDTO other = (HttpProxyDTO) obj;
		if (authName == null) {
			if (other.authName != null)
				return false;
		} else if (!authName.equals(other.authName))
			return false;
		if (authPwd == null) {
			if (other.authPwd != null)
				return false;
		} else if (!authPwd.equals(other.authPwd))
			return false;
		if (ipAddress == null) {
			if (other.ipAddress != null)
				return false;
		} else if (!ipAddress.equals(other.ipAddress))
			return false;
		if (isNeedAuth != other.isNeedAuth)
			return false;
		if (port != other.port)
			return false;
		if (proportion != other.proportion)
			return false;
		return true;
	}
}
